package com.gaofei.jpa.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.time.LocalDate;
import java.util.List;

@Getter
@Setter
@Entity
@Table(name = "administrative_division")
public class AdministrativeDivision {

    /**
     * 省市区县名称
     */

    @Column(name = "c_name" )
    private String cName;

    /**
     * 行政区划代码
     */
    @Column(name = "code" )
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private String code;

    /**
     * 省市区县的名称拼音,名称和级别中间有空格
     */
    @Column(name = "py" )
    private String py;

    /**
     * 省市区县的名称拼音简拼
     */
    @Column(name = "jp" )
    private String jp;

    /**
     * 省市区县的名称拼音全拼
     */
    @Column(name = "qp" )
    private String qp;

    /**
     * 数据来源
     */
    @Column(name = "source_url" )
    @JSONField(serialize = false)
    private String sourceUrl;

    /**
     * 数据更新时间
     */
    @Column(name = "update_time" )
    private LocalDate updateTime;

    @Transient
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<AdministrativeDivision> administrativeDivisions;
}
